//
//  UIButton+Extension.swift
//  sinaMicroBlog
//
//  Created by mac on 15/11/17.
//  Copyright © 2015年 mac. All rights reserved.
//

import UIKit

extension UIButton {
    convenience init(title: String?, backImage: String?, titleColor: UIColor?, image: String  = "", size: CGFloat = 14){
        
        self.init()
        if title != nil {
            setTitle(title, forState: .Normal)
        }
        if backImage != nil {
            setBackgroundImage(UIImage(named: backImage!), forState: .Normal)
            setBackgroundImage(UIImage(named: backImage! + "_Hlighlighted"), forState: .Highlighted)
        }
        titleLabel?.font = UIFont.systemFontOfSize(size)
        setImage(UIImage(named: image), forState: .Normal)
        if titleColor != nil {
            setTitleColor(titleColor, forState: .Normal)
        }
        
    }
}